import formatRichText from '@/utils/dealWithTextImg'
import styles from './index.module.less'
interface ListItem {
    id: number
    personal_image: string
    username: string
    address: string
    user_account: string
}

interface ListType {
    list?: ListItem[]
}

const StudentVoices = ({ list }: ListType) => {
    return (
        <div className={styles.StudentVoices}>
            {list?.map((item: ListItem) => {
                return (
                    <div className={styles.content_item} key={item.id}>
                        <div className={styles.item_top}>
                            <img src={item.personal_image || 'http://img.busionline.com/avatar.png'} className={styles.item_img} />
                            <div className={styles.item_tips}>
                                <div className={styles.title}>{item.username}</div>
                                <div className={styles.adress}>{item.address}</div>
                            </div>
                        </div>
                        <div
                            className={styles.item_content}
                            dangerouslySetInnerHTML={{
                                __html: formatRichText(item.user_account),
                            }}
                        />
                    </div>
                )
            })}
        </div>
    )
}

export default StudentVoices
